<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-bind重复遍历组件</title>
    <script src="/vue.js"></script>
</head>
<body>
    <div id="app">
        <!-- ol是无序列表 -->
        <ol>
            <!-- v-for循环遍历item，用key指定ID遍历，同时v-bind动态绑定title -->
            <child v-for="item in names" :key="item.id" v-bind:title="item"></child>
        </ol>
    </div>

    <script>
        Vue.component("child",{
            props:["title"],
            data(){
                return{}
            },
            template:`<li>{{title.text}}</li>`
        })
        new Vue({
            el:'#app',
            data(){
                return{
                    names:[
                        {text:'小胖胖'},
                        {text:'二胖胖'},
                        {text:'三胖胖'},
                        {text:'四胖胖'},
                        {text:'五胖胖'},
                        {text:'六胖胖'},
                        {text:'七胖胖'},
                    ]
                }
            },
        })
    </script>
</body>
</html>